package com.example.skindemo.ui.settings;

import android.util.Log;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.skindemo.Constants;
import com.example.skindemo.loader.SkinApiManager;
import com.example.skindemo.ui.bean.SkinThemeBean;

import java.util.ArrayList;
import java.util.List;

public class SettingViewModel extends ViewModel {


    private MutableLiveData<List<SkinThemeBean>> skinThemeBeanMutableLiveData;
    List<SkinThemeBean> skinThemeBeanList = new ArrayList<>();
    List<SkinThemeBean> skinThemeSDBeanList = new ArrayList<>();

    List<String> colottextList = new ArrayList<>();
    List<String> colotList = new ArrayList<>();
    List<Integer> colotThemeList = new ArrayList<>();

    public SettingViewModel() {

        skinThemeBeanMutableLiveData = new MutableLiveData<>();
        colottextList.add(Constants.SKIN_NAME_TEXT.WHITE);
        colottextList.add(Constants.SKIN_NAME_TEXT.BLACK);
        colottextList.add(Constants.SKIN_NAME_TEXT.BLUE);
        colottextList.add(Constants.SKIN_NAME_TEXT.GREEN);
        colottextList.add(Constants.SKIN_NAME_TEXT.ORANGE);
        colottextList.add(Constants.SKIN_NAME_TEXT.PINK);
        colottextList.add(Constants.SKIN_NAME_TEXT.RED);
        colottextList.add(Constants.SKIN_NAME_TEXT.YELLOW);

        colotList.add(Constants.SKIN_NAME.WHITE);
        colotList.add(Constants.SKIN_NAME.BLACK);
        colotList.add(Constants.SKIN_NAME.BLUE);
        colotList.add(Constants.SKIN_NAME.GREEN);
        colotList.add(Constants.SKIN_NAME.ORANGE);
        colotList.add(Constants.SKIN_NAME.PINK);
        colotList.add(Constants.SKIN_NAME.RED);
        colotList.add(Constants.SKIN_NAME.YELLOW);

        colotThemeList.add(Constants.SKIN_NAME_RES.WHITE);
        colotThemeList.add(Constants.SKIN_NAME_RES.BLACK);
        colotThemeList.add(Constants.SKIN_NAME_RES.BLUE);
        colotThemeList.add(Constants.SKIN_NAME_RES.GREEN);
        colotThemeList.add(Constants.SKIN_NAME_RES.ORANGE);
        colotThemeList.add(Constants.SKIN_NAME_RES.PINK);
        colotThemeList.add(Constants.SKIN_NAME_RES.RED);
        colotThemeList.add(Constants.SKIN_NAME_RES.YELLOW);

        String skinName = SkinApiManager.getSkinName();
        Log.i("测试  ", "皮肤颜色==" + skinName);
        for (int i = 0; i < colotList.size(); i++) {
            SkinThemeBean skinThemeBean = new SkinThemeBean();
            if (skinName.contains(colotList.get(i))) {
                skinThemeBean.setCheckTheme(true);
            } else {
                skinThemeBean.setCheckTheme(false);
            }
            skinThemeBean.setThemeType(colotThemeList.get(i));
            skinThemeBean.setThemeName(colottextList.get(i));
            skinThemeBean.setThemeNameColor(colotList.get(i));
            skinThemeBeanList.add(skinThemeBean);
            skinThemeSDBeanList.add(skinThemeBean);
        }
        skinThemeBeanMutableLiveData.setValue(skinThemeBeanList);
    }


    public MutableLiveData<List<SkinThemeBean>> getSkinThemeBeanMutableLiveData() {
        return skinThemeBeanMutableLiveData;
    }
}